package designmode.Proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {
        IUser user = new UserImpl();
        user.login();
        System.out.println("------------------------");
        InvocationHandler handler = new MyInvocationHandler(user);
        IUser proxy = (IUser) Proxy.newProxyInstance(user.getClass().getClassLoader(), user.getClass().getInterfaces(), handler);
        proxy.login();
    }
}
